<?php
session_start(); 
header ('Content-type: text/html; charset=utf-8');
?>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script> 


<?php
$host = "http://walkpm.dyndns.org/";

require_once 'Social/Vkontakte.php';
require_once 'Social.php';

//unset($_SESSION['user_info']);
if( !isset( $_SESSION['user_info'] ) )
{

    $auth = new Social();
    $auth->addService( new Social_Vkontakte( 2287579 , "WCu1Tdb7TKzILqfrZyrc" ) );
    $auth->setRedirectUrl( $host . "auth_test/" );
    $auth->init();
    if( !$auth->listenService( $_GET ) )
    {
        ?>
        <a id="social-vkontakte" href="">Login by vkontakte.ru</a>
        <?php
        echo $auth->getButtonsHandler();
    }
    else
    {
        echo $auth->getUserId();
        $_SESSION['user_info'] = $auth->getUserInfo( $auth->getUserId() );
        echo $auth->getCloseScript();
    }
}
else
{
    print_r( $_SESSION['user_info'] );
}

?>